import request from "../tools/request";
import qs from "qs";

export function getLikenum(data) {
  return request.get(
    "/python/getLikenum?" +
      qs.stringify(data, {
        encode: true,
        arrayFormat: "brackets" // 设置数组的序列化，-> {a: [1,2]} => a[]=1&a[]=2,与jq序列化结果相同
      })
  );
}

export function getCollectnum(data) {
  return request.get(
    "/python/getCollectnum?" +
      qs.stringify(data, {
        encode: true,
        arrayFormat: "brackets" // 设置数组的序列化，-> {a: [1,2]} => a[]=1&a[]=2,与jq序列化结果相同
      })
  );
}

export function getCommentnum(data) {
  return request.get(
    "/python/getCommentnum?goods_id=" +
      data.goods_id +
      "&user_id=" +
      data.user_id
  );
}

export function getCommentList(data) {
  return request.get(
    "/python/getCommentList?goods_id=" +
      data.goods_id +
      "&user_id=" +
      data.user_id +
      "&two_id=" +
      data.two_id
  );
}

export function addComment(data) {
  return request.post("/python/addComment", data);
}
export function deletComment(data) {
  return request.post("/python/deletComment", data);
}

export function addLike(data) {
  return request.post("/python/addLike", data);
}

export function addCollect(data) {
  return request.post("/python/addCollect", data);
}

export function deletLike(data) {
  return request.post("/python/deletLike", data);
}

export function deletCollect(data) {
  return request.post("/python/deletCollect", data);
}

export function getCollectList(data) {
  return request.get(
    "/python/getCollectList?currPage=" +
      data.currPage +
      "&pageSize=" +
      data.pageSize +
      "&user_id=" +
      data.user_id
  );
}

export function getLikeList(data) {
  return request.get(
    "/python/getLikeList?currPage=" +
      data.currPage +
      "&pageSize=" +
      data.pageSize +
      "&user_id=" +
      data.user_id
  );
}

export function getOrderData(data) {
  return request.get(
    "/python/getOrderData?currPage=" +
      data.currPage +
      "&pageSize=" +
      data.pageSize +
      "&user_id=" +
      data.user_id
  );
}
